<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>"/>
    <title>会员管理</title>
    <link rel="stylesheet" href="static/themes/bootstrap/easyui.css">
    <link rel="stylesheet" href="static/css/base.css">
    <script src="static/javascript/jquery-1.11.3.min.js"></script>
    <script src="static/javascript/jquery.easyui.min.js"></script>
    <script src="static/javascript/utils.js"></script>
    <script src="static/javascript/base.js"></script>

    <link rel="stylesheet" href="plugins/bootstrap-3.3.5-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="plugins/bootstrap-3.3.5-dist/css/bootstrap-theme.min.css">
    <script src="plugins/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" language="JavaScript">
        $(document).ready(function(){
            var main = "#main"
            $(".showMember").click(function () {
                obj=$.ajax({url:"user/personalInfo?userId=" + $(this).attr("name"),async:false});
                $(main).html(obj.responseText);
            });
            $(".deleteMember").click(function () {
                if(confirm("是否确认删除？")) {
                    obj=$.ajax({url:"admin/memberManage/memberDelete?userId=" + $(this).attr("name"),async:false});
                    $(main).html(obj.responseText);
                    $("#memberManage").click();
                }
            });
            $("#search").click(function () {
                var text = $("#searchInput").val();
                if("" == ($.trim(text))) {
                    alert("搜索内容不可以为空");
                } else {
                    obj=$.ajax({url:"admin/memberManage/memberSearch?text=" + encodeURI(encodeURI(text)), async:false});
                    $(main).html(obj.responseText);
                }
            });

        });
    </script>
</head>
<body>
<div>
    <div class="articleHead">
        <input id="searchInput" name="searchInput" class="searchInput" type="text" placeholder="搜索会员..." value="${searchInput}"/>&nbsp;
        <button id="search">搜索</button>
    </div>
    <div class="articleList">
        <table>
            <col span="1" width="10%"/>
            <col span="3" width="20%"/>
            <col span="1" width="10%"/>
            <tr>
                <th>编号</th>
                <th>会员名称</th>
                <th>上次登录时间</th>
                <th>注册时间</th>
                <th>删除</th>
            </tr>
            <c:forEach items="${memberList}" var="member" varStatus="vs">
                <tr>
                    <td>
                        ${vs.index + 1}
                    </td>
                    <td>
                        <a class="showMember">${member.userName}</a>
                    </td>
                    <td>
                        <spring:eval expression="member.lastLoginTime"></spring:eval>
                    </td>
                    <td>
                        <spring:eval expression="member.registerTime"></spring:eval>
                    </td>
                    <td>
                        <a class="deleteMember" name="${member.id}">删除会员</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </div>

</div>
</body>
</html>